/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.inria.openmath.omapi;

/**
 *
 * @author Mr.Sam
 */
import java.io.*;


/**
 * Basic interface for OpenMath tree printers.
 *
 * <p>All OpenMath tree printers must implement this basic interface: it allows
 * applications to output OpenMath object trees on a character stream.</p>
 *
 * @see fr.inria.openmath.omapi.implementation.TreePrinterImpl
 */
public interface TreePrinter {

    /**
     * Allows an application to set the printer used during tree traversal.
     *
     * <p>Set the printer.
     * The printer may be changed during print.
     * But, this is possible only between two OpenMath object output.
     * Or else a OMException is thrown, and current output stream is not
     * changed.
     *
     * @param output the new printer
     *
     * @exception fr.inria.openmath.omapi.OMException Any OpenMath exception.
     * @see fr.inria.openmath.omapi.implementation.XMLPrinter
     * @see fr.inria.openmath.omapi.implementation.BinaryPrinter
     * @see fr.inria.openmath.omapi.implementation.HumanPrinter
     */
    public void setPrinter(Printer output) throws OMException ;

    /**
     * Allows an application to get the current printer.
     *
     * <p>Get the current printer
     * @return the current printer (or NULL if none is set)
     */
    public Printer getPrinter() ;

    /**
     * Print a whole tree.
     *
     * <p> Print a whole tree.
     * @param root The root node of the tree to print.
     * @exception fr.inria.openmath.omapi.OMException Any OpenMath exception.
     */
    public void printTree(Node root) throws OMException ;

    /**
     * Does what is needed when print has been completed.
     *
     * <p>It must be called when no more print is to be done on this printer.
     *
     * @see fr.inria.openmath.omapi.Symbol
     * @exception fr.inria.openmath.omapi.OMException Any OpenMath exception.
     */
    public void endPrint() throws OMException ;

}
